package org.pzy.java.concurrency;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @Author: DRevelation
 * @Date: 2022/5/24 13:20
 */
public class PublicExecutorTest {

    public static final ExecutorService executorService = Executors.newSingleThreadExecutor();

    public static void main(String[] args) throws InterruptedException {
        for (int i = 0; i < 3; i++) {
            int finalI = i;
            executorService.submit(() -> System.out.println("exec-" + finalI));
            Thread.sleep(2 * 1000);
        }
    }
}
